<%@page import="service.implement.TimesheetDAO"%>
<%@page import="model.TimesheetDetail"%>
<%@page import="com.sun.xml.internal.bind.v2.schemagen.xmlschema.List"%>
<%@page import="service.Constan"%>
<%@page import="service.implement.ProjectDAO"%>
<%@page import="model.Project"%>
<%@page import="service.implement.EmployeeDAO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="model.Employee"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
	function validateForm() {
		var date = document.forms["form"]["date"].value;
		var duration = document.forms["form"]["duration"].value;
		var description = document.forms["form"]["description"].value;
		var activity = document.forms["form"]["activity"].value;
		if (date == "") {
			alert("Date khong duoc de trong");
			return false;
		}
		if (duration == "") {
			alert("Duration khong duoc de trong");
			return false;
		}
		if (description == "") {
			alert("Description khong duoc de trong");
			return false;
		}
	}
</script>
</head>
<body>
	<%@ include file="Menu.jsp"%>
	<div class="panel panel-default">
		<!-- Default panel contents -->
		<div class="panel-heading">Add new Timesheet</div>
		<br>
		<form class="form-horizontal" action="doaddTimesheet" method="post"
			name="form" onsubmit="return validateForm()">
			<%
				ArrayList<Employee> list = new EmployeeDAO().getEmployee();
			%>
			<%
				ArrayList<Project> list1 = new ProjectDAO().getProject();
			%>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Employee</label>
				<div class="col-sm-10">
					<select name="employeeid">
						<%
							for (Employee e : list) {
						%>
						<option value="<%=e.getId()%>"><%=e.getName()%></option>

						<%
							}
						%>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Project</label>
				<div class="col-sm-10">
					<select name="projectid">
						<%
							for (Project p : list1) {
						%>
						<option value="<%=p.getId()%>"><%=p.getNameProject()%></option>

						<%
							}
						%>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Date</label>
				<div class="col-sm-10">
					<input type="date" name="date" value="" />

				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Duration</label>
				<div class="col-sm-10">
					<input type="number" name="duration" value="" />

				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Description</label>
				<div class="col-sm-10">
					<input type="text" name="description" value="" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Activity</label>
				<div class="col-sm-10">
					<input type="text" name="activity" value="" />

				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Overtime</label>
				<div class="col-sm-10">
					<select name="overtime">
						<option value=<%=Constan.SER_STATUS_FALSE%>>No</option>
						<option value=<%=Constan.SER_STATUS_TRUE%>>Yes</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">Location</label>
				<div class="col-sm-10">
					<select name="location">
						<option value=<%=Constan.LOCATION_THNC%>>THNC</option>
						<option value=<%=Constan.LOCATION_HN%>>Ha Noi</option>
						<option value=<%=Constan.LOCATION_HCM%>>HCM</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					<input type="submit" name="nhap" value="Add" />
				</div>
			</div>
		</form>
	</div>
	
</body>
</html>